package org.applet.game.app.rpg.resource;

import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.awt.image.ImageObserver;
import java.io.File;

abstract public class ImageStore {

	int xFrameCount;
	int yFrameCount = 8;
	
	int x;
	int y;
	
	public abstract BufferedImage getImage();
	
	public abstract boolean shiftView(int x, int y);

	public boolean moveViewX(int x)
	{
		if(x>xFrameCount)
		{
			this.x = 0;
			return false;
		}
		else
		{
			this.x = x;
			return true;
		}
	}
	public boolean moveViewY(int y)
	{
		if(y>yFrameCount)
		{
			this.y = 0;
			return false;
		}
		else
		{
			this.y = y;
			return true;
		}
	}
	public abstract boolean shiftNextX();
	public abstract boolean shiftNextY();
	
	public abstract void load();
	
	public abstract void seftRender(Graphics painter, int x, int y, ImageObserver observer);
	
	public abstract void saveTo(File file);

	public int getXFrameCount() {
		return xFrameCount;
	}

	public void setXFrameCount(int xFrame) {
		this.xFrameCount = xFrame;
	}

	public int getYFrameCount() {
		return yFrameCount;
	}

	public void setYFrameCount(int yFrame) {
		this.yFrameCount = yFrame;
	}

	public int getViewX() {
		return x;
	}

	public int getViewY() {
		return y;
	}

}
